3.12.98 \(\int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx\) [1198]

Optimal. Leaf size=131 \[ (a c-b c-a d-b d) (a c+b c+a d-b d) x-\frac {2 (b c+a d) (a c-b d) \log (\cos (e+f x))}{f}+\frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f} \]

[Out]

(a*c-a*d-b*c-b*d)*(a*c+a*d+b*c-b*d)*x-2*(a*d+b*c)*(a*c-b*d)*ln(cos(f*x+e))/f+b*(2*a*c*d+b*(c^2-d^2))*tan(f*x+e
)/f+c*d*(a+b*tan(f*x+e))^2/f+1/3*d^2*(a+b*tan(f*x+e))^3/b/f

________________________________________________________________________________________

Rubi [A]
time = 0.13, antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.160, Rules used = {3624, 3609, 3606, 3556} \begin {gather*} \frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}-\frac {2 (a d+b c) (a c-b d) \log (\cos (e+f x))}{f}+x (a c-a d-b c-b d) (a c+a d+b c-b d)+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^2,x]

[Out]

(a*c - b*c - a*d - b*d)*(a*c + b*c + a*d - b*d)*x - (2*(b*c + a*d)*(a*c - b*d)*Log[Cos[e + f*x]])/f + (b*(2*a*
c*d + b*(c^2 - d^2))*Tan[e + f*x])/f + (c*d*(a + b*Tan[e + f*x])^2)/f + (d^2*(a + b*Tan[e + f*x])^3)/(3*b*f)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3609

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*
((a + b*Tan[e + f*x])^m/(f*m)), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3624

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rubi steps

\begin {align*} \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^2 \, dx &=\frac {d^2 (a+b \tan (e+f x))^3}{3 b f}+\int (a+b \tan (e+f x))^2 \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx\\ &=\frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f}+\int (a+b \tan (e+f x)) \left (-2 b c d+a \left (c^2-d^2\right )+\left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)\right ) \, dx\\ &=(a c-b c-a d-b d) (a c+b c+a d-b d) x+\frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f}+(2 (b c+a d) (a c-b d)) \int \tan (e+f x) \, dx\\ &=(a c-b c-a d-b d) (a c+b c+a d-b d) x-\frac {2 (b c+a d) (a c-b d) \log (\cos (e+f x))}{f}+\frac {b \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {c d (a+b \tan (e+f x))^2}{f}+\frac {d^2 (a+b \tan (e+f x))^3}{3 b f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 1.13, size = 185, normalized size = 1.41 \begin {gather*} \frac {2 d^2 (a+b \tan (e+f x))^3+3 \left (2 a c d+b \left (-c^2+d^2\right )\right ) \left (i \left ((a+i b)^2 \log (i-\tan (e+f x))-(a-i b)^2 \log (i+\tan (e+f x))\right )-2 b^2 \tan (e+f x)\right )+6 c d \left ((i a-b)^3 \log (i-\tan (e+f x))-(i a+b)^3 \log (i+\tan (e+f x))+6 a b^2 \tan (e+f x)+b^3 \tan ^2(e+f x)\right )}{6 b f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[e + f*x])^2*(c + d*Tan[e + f*x])^2,x]

[Out]

(2*d^2*(a + b*Tan[e + f*x])^3 + 3*(2*a*c*d + b*(-c^2 + d^2))*(I*((a + I*b)^2*Log[I - Tan[e + f*x]] - (a - I*b)
^2*Log[I + Tan[e + f*x]]) - 2*b^2*Tan[e + f*x]) + 6*c*d*((I*a - b)^3*Log[I - Tan[e + f*x]] - (I*a + b)^3*Log[I
 + Tan[e + f*x]] + 6*a*b^2*Tan[e + f*x] + b^3*Tan[e + f*x]^2))/(6*b*f)

________________________________________________________________________________________

Maple [A]
time = 0.10, size = 189, normalized size = 1.44

method result size
norman \(\left (a^{2} c^{2}-a^{2} d^{2}-4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) x +\frac {\left (a^{2} d^{2}+4 a b c d +b^{2} c^{2}-b^{2} d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {b d \left (a d +b c \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{f}+\frac {b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {\left (a^{2} c d +a b \,c^{2}-a b \,d^{2}-b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f}\) \(162\)
derivativedivides \(\frac {\frac {b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+a b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )+b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )+a^{2} d^{2} \tan \left (f x +e \right )+4 a b c d \tan \left (f x +e \right )+b^{2} c^{2} \tan \left (f x +e \right )-b^{2} d^{2} \tan \left (f x +e \right )+\frac {\left (2 a^{2} c d +2 a b \,c^{2}-2 a b \,d^{2}-2 b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c^{2}-a^{2} d^{2}-4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(189\)
default \(\frac {\frac {b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+a b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )+b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )+a^{2} d^{2} \tan \left (f x +e \right )+4 a b c d \tan \left (f x +e \right )+b^{2} c^{2} \tan \left (f x +e \right )-b^{2} d^{2} \tan \left (f x +e \right )+\frac {\left (2 a^{2} c d +2 a b \,c^{2}-2 a b \,d^{2}-2 b^{2} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c^{2}-a^{2} d^{2}-4 a b c d -b^{2} c^{2}+b^{2} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(189\)
risch \(-\frac {4 i b^{2} c d e}{f}+\frac {4 i a b \,c^{2} e}{f}-2 i b^{2} c d x -\frac {4 i a b \,d^{2} e}{f}+a^{2} c^{2} x -a^{2} d^{2} x -4 a b c d x -b^{2} c^{2} x +b^{2} d^{2} x -2 i a b \,d^{2} x +\frac {4 i a^{2} c d e}{f}+2 i a b \,c^{2} x +\frac {2 i \left (-6 i a b \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-6 i b^{2} c d \,{\mathrm e}^{2 i \left (f x +e \right )}+3 a^{2} d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+12 a b c d \,{\mathrm e}^{4 i \left (f x +e \right )}+3 b^{2} c^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 b^{2} d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 i a b \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 i b^{2} c d \,{\mathrm e}^{4 i \left (f x +e \right )}+6 a^{2} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+24 a b c d \,{\mathrm e}^{2 i \left (f x +e \right )}+6 b^{2} c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-6 b^{2} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 a^{2} d^{2}+12 a b c d +3 b^{2} c^{2}-4 b^{2} d^{2}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}+2 i a^{2} c d x -\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} c d}{f}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a b \,c^{2}}{f}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a b \,d^{2}}{f}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{2} c d}{f}\) \(465\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(1/3*b^2*d^2*tan(f*x+e)^3+a*b*d^2*tan(f*x+e)^2+b^2*c*d*tan(f*x+e)^2+a^2*d^2*tan(f*x+e)+4*a*b*c*d*tan(f*x+e
)+b^2*c^2*tan(f*x+e)-b^2*d^2*tan(f*x+e)+1/2*(2*a^2*c*d+2*a*b*c^2-2*a*b*d^2-2*b^2*c*d)*ln(1+tan(f*x+e)^2)+(a^2*
c^2-a^2*d^2-4*a*b*c*d-b^2*c^2+b^2*d^2)*arctan(tan(f*x+e)))

________________________________________________________________________________________

Maxima [A]
time = 0.56, size = 164, normalized size = 1.25 \begin {gather*} \frac {b^{2} d^{2} \tan \left (f x + e\right )^{3} + 3 \, {\left (b^{2} c d + a b d^{2}\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left (4 \, a b c d - {\left (a^{2} - b^{2}\right )} c^{2} + {\left (a^{2} - b^{2}\right )} d^{2}\right )} {\left (f x + e\right )} + 3 \, {\left (a b c^{2} - a b d^{2} + {\left (a^{2} - b^{2}\right )} c d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 3 \, {\left (b^{2} c^{2} + 4 \, a b c d + {\left (a^{2} - b^{2}\right )} d^{2}\right )} \tan \left (f x + e\right )}{3 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

1/3*(b^2*d^2*tan(f*x + e)^3 + 3*(b^2*c*d + a*b*d^2)*tan(f*x + e)^2 - 3*(4*a*b*c*d - (a^2 - b^2)*c^2 + (a^2 - b
^2)*d^2)*(f*x + e) + 3*(a*b*c^2 - a*b*d^2 + (a^2 - b^2)*c*d)*log(tan(f*x + e)^2 + 1) + 3*(b^2*c^2 + 4*a*b*c*d
+ (a^2 - b^2)*d^2)*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]
time = 0.63, size = 162, normalized size = 1.24 \begin {gather*} \frac {b^{2} d^{2} \tan \left (f x + e\right )^{3} - 3 \, {\left (4 \, a b c d - {\left (a^{2} - b^{2}\right )} c^{2} + {\left (a^{2} - b^{2}\right )} d^{2}\right )} f x + 3 \, {\left (b^{2} c d + a b d^{2}\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left (a b c^{2} - a b d^{2} + {\left (a^{2} - b^{2}\right )} c d\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 3 \, {\left (b^{2} c^{2} + 4 \, a b c d + {\left (a^{2} - b^{2}\right )} d^{2}\right )} \tan \left (f x + e\right )}{3 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/3*(b^2*d^2*tan(f*x + e)^3 - 3*(4*a*b*c*d - (a^2 - b^2)*c^2 + (a^2 - b^2)*d^2)*f*x + 3*(b^2*c*d + a*b*d^2)*ta
n(f*x + e)^2 - 3*(a*b*c^2 - a*b*d^2 + (a^2 - b^2)*c*d)*log(1/(tan(f*x + e)^2 + 1)) + 3*(b^2*c^2 + 4*a*b*c*d +
(a^2 - b^2)*d^2)*tan(f*x + e))/f

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 258 vs. \(2 (117) = 234\).
time = 0.14, size = 258, normalized size = 1.97 \begin {gather*} \begin {cases} a^{2} c^{2} x + \frac {a^{2} c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - a^{2} d^{2} x + \frac {a^{2} d^{2} \tan {\left (e + f x \right )}}{f} + \frac {a b c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - 4 a b c d x + \frac {4 a b c d \tan {\left (e + f x \right )}}{f} - \frac {a b d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {a b d^{2} \tan ^{2}{\left (e + f x \right )}}{f} - b^{2} c^{2} x + \frac {b^{2} c^{2} \tan {\left (e + f x \right )}}{f} - \frac {b^{2} c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {b^{2} c d \tan ^{2}{\left (e + f x \right )}}{f} + b^{2} d^{2} x + \frac {b^{2} d^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {b^{2} d^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right )^{2} \left (c + d \tan {\left (e \right )}\right )^{2} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))**2*(c+d*tan(f*x+e))**2,x)

[Out]

Piecewise((a**2*c**2*x + a**2*c*d*log(tan(e + f*x)**2 + 1)/f - a**2*d**2*x + a**2*d**2*tan(e + f*x)/f + a*b*c*
*2*log(tan(e + f*x)**2 + 1)/f - 4*a*b*c*d*x + 4*a*b*c*d*tan(e + f*x)/f - a*b*d**2*log(tan(e + f*x)**2 + 1)/f +
 a*b*d**2*tan(e + f*x)**2/f - b**2*c**2*x + b**2*c**2*tan(e + f*x)/f - b**2*c*d*log(tan(e + f*x)**2 + 1)/f + b
**2*c*d*tan(e + f*x)**2/f + b**2*d**2*x + b**2*d**2*tan(e + f*x)**3/(3*f) - b**2*d**2*tan(e + f*x)/f, Ne(f, 0)
), (x*(a + b*tan(e))**2*(c + d*tan(e))**2, True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 2258 vs. \(2 (133) = 266\).
time = 1.28, size = 2258, normalized size = 17.24 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))^2*(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

1/3*(3*a^2*c^2*f*x*tan(f*x)^3*tan(e)^3 - 3*b^2*c^2*f*x*tan(f*x)^3*tan(e)^3 - 12*a*b*c*d*f*x*tan(f*x)^3*tan(e)^
3 - 3*a^2*d^2*f*x*tan(f*x)^3*tan(e)^3 + 3*b^2*d^2*f*x*tan(f*x)^3*tan(e)^3 - 3*a*b*c^2*log(4*(tan(f*x)^4*tan(e)
^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^
3*tan(e)^3 - 3*a^2*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2
*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 + 3*b^2*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^
3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 + 3*a
*b*d^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e)
 + 1)/(tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 - 9*a^2*c^2*f*x*tan(f*x)^2*tan(e)^2 + 9*b^2*c^2*f*x*tan(f*x)^2*tan(e
)^2 + 36*a*b*c*d*f*x*tan(f*x)^2*tan(e)^2 + 9*a^2*d^2*f*x*tan(f*x)^2*tan(e)^2 - 9*b^2*d^2*f*x*tan(f*x)^2*tan(e)
^2 + 3*b^2*c*d*tan(f*x)^3*tan(e)^3 + 3*a*b*d^2*tan(f*x)^3*tan(e)^3 + 9*a*b*c^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*
tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^2*tan(e
)^2 + 9*a^2*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*
x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 9*b^2*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e
) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 9*a*b*d^2*
log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(
tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 3*b^2*c^2*tan(f*x)^3*tan(e)^2 - 12*a*b*c*d*tan(f*x)^3*tan(e)^2 - 3*a^2*d^
2*tan(f*x)^3*tan(e)^2 + 3*b^2*d^2*tan(f*x)^3*tan(e)^2 - 3*b^2*c^2*tan(f*x)^2*tan(e)^3 - 12*a*b*c*d*tan(f*x)^2*
tan(e)^3 - 3*a^2*d^2*tan(f*x)^2*tan(e)^3 + 3*b^2*d^2*tan(f*x)^2*tan(e)^3 + 9*a^2*c^2*f*x*tan(f*x)*tan(e) - 9*b
^2*c^2*f*x*tan(f*x)*tan(e) - 36*a*b*c*d*f*x*tan(f*x)*tan(e) - 9*a^2*d^2*f*x*tan(f*x)*tan(e) + 9*b^2*d^2*f*x*ta
n(f*x)*tan(e) + 3*b^2*c*d*tan(f*x)^3*tan(e) + 3*a*b*d^2*tan(f*x)^3*tan(e) - 3*b^2*c*d*tan(f*x)^2*tan(e)^2 - 3*
a*b*d^2*tan(f*x)^2*tan(e)^2 + 3*b^2*c*d*tan(f*x)*tan(e)^3 + 3*a*b*d^2*tan(f*x)*tan(e)^3 - b^2*d^2*tan(f*x)^3 -
 9*a*b*c^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*ta
n(e) + 1)/(tan(e)^2 + 1))*tan(f*x)*tan(e) - 9*a^2*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f
*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)*tan(e) + 9*b^2*c*d*log(4*(tan(f*
x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1)
)*tan(f*x)*tan(e) + 9*a*b*d^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x
)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)*tan(e) + 6*b^2*c^2*tan(f*x)^2*tan(e) + 24*a*b*c*d*tan(f*
x)^2*tan(e) + 6*a^2*d^2*tan(f*x)^2*tan(e) - 9*b^2*d^2*tan(f*x)^2*tan(e) + 6*b^2*c^2*tan(f*x)*tan(e)^2 + 24*a*b
*c*d*tan(f*x)*tan(e)^2 + 6*a^2*d^2*tan(f*x)*tan(e)^2 - 9*b^2*d^2*tan(f*x)*tan(e)^2 - b^2*d^2*tan(e)^3 - 3*a^2*
c^2*f*x + 3*b^2*c^2*f*x + 12*a*b*c*d*f*x + 3*a^2*d^2*f*x - 3*b^2*d^2*f*x - 3*b^2*c*d*tan(f*x)^2 - 3*a*b*d^2*ta
n(f*x)^2 + 3*b^2*c*d*tan(f*x)*tan(e) + 3*a*b*d^2*tan(f*x)*tan(e) - 3*b^2*c*d*tan(e)^2 - 3*a*b*d^2*tan(e)^2 + 3
*a*b*c^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(
e) + 1)/(tan(e)^2 + 1)) + 3*a^2*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + t
an(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1)) - 3*b^2*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e
) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1)) - 3*a*b*d^2*log(4*(tan(f*x)^4*ta
n(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1)) - 3*b
^2*c^2*tan(f*x) - 12*a*b*c*d*tan(f*x) - 3*a^2*d^2*tan(f*x) + 3*b^2*d^2*tan(f*x) - 3*b^2*c^2*tan(e) - 12*a*b*c*
d*tan(e) - 3*a^2*d^2*tan(e) + 3*b^2*d^2*tan(e) - 3*b^2*c*d - 3*a*b*d^2)/(f*tan(f*x)^3*tan(e)^3 - 3*f*tan(f*x)^
2*tan(e)^2 + 3*f*tan(f*x)*tan(e) - f)

________________________________________________________________________________________

Mupad [B]
time = 5.28, size = 230, normalized size = 1.76 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2\,d^2+4\,a\,b\,c\,d+b^2\,c^2-b^2\,d^2\right )}{f}+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (a^2\,c\,d+a\,b\,c^2-a\,b\,d^2-b^2\,c\,d\right )}{f}-\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a\,c+a\,d+b\,c-b\,d\right )\,\left (a\,d-a\,c+b\,c+b\,d\right )}{-a^2\,c^2+a^2\,d^2+4\,a\,b\,c\,d+b^2\,c^2-b^2\,d^2}\right )\,\left (a\,c+a\,d+b\,c-b\,d\right )\,\left (a\,d-a\,c+b\,c+b\,d\right )}{f}+\frac {b^2\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f}+\frac {b\,d\,{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (a\,d+b\,c\right )}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tan(e + f*x))^2*(c + d*tan(e + f*x))^2,x)

[Out]

(tan(e + f*x)*(a^2*d^2 + b^2*c^2 - b^2*d^2 + 4*a*b*c*d))/f + (log(tan(e + f*x)^2 + 1)*(a*b*c^2 - a*b*d^2 + a^2
*c*d - b^2*c*d))/f - (atan((tan(e + f*x)*(a*c + a*d + b*c - b*d)*(a*d - a*c + b*c + b*d))/(a^2*d^2 - a^2*c^2 +
 b^2*c^2 - b^2*d^2 + 4*a*b*c*d))*(a*c + a*d + b*c - b*d)*(a*d - a*c + b*c + b*d))/f + (b^2*d^2*tan(e + f*x)^3)
/(3*f) + (b*d*tan(e + f*x)^2*(a*d + b*c))/f

________________________________________________________________________________________